package levelloader
{
	public class ObjectLayerData
	{
		private var _name:String;
		private var _width:Number;
		private var _height:Number;		
		
		private var _mapObjects:Vector.<ObjectData>;
		
		public function ObjectLayerData(data:XML)
		{
			_name = data.@name;
			_width = data.@width;
			_height = data.@height;
			
			_mapObjects = new Vector.<ObjectData>();
			
			for(var idx:uint = 0; idx < data.children().length(); ++idx)
			{
				var obj:Object = data.object[idx];
				
				if (obj != null)
				{
					var tempObjectData:ObjectData = new ObjectData(obj.@x, obj.@y, obj.@width, obj.@height); 
					_mapObjects.push(tempObjectData);
				}
			}
		}

		public function get mapObjects():Vector.<ObjectData>
		{
			return _mapObjects;
		}
	}		
}

class ObjectData
{
	private var _x:Number; 
	private var _y:Number;
	private var _width:Number; 
	private var _height:Number;

	public function ObjectData(	x:Number, y:Number, width:Number, height:Number)
	{
		_x = x;
		_y = y;
		_width = width;
		_height = height;
	}

	public function get x():Number
	{
		return _x;
	}

	public function get y():Number
	{
		return _y;
	}

	public function get width():Number
	{
		return _width;
	}

	public function get height():Number
	{
		return _height;
	}
}		